package com.data.monitoring.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 监控执行历史
 * </p>
 *
 * @author HanYiMing
 * @since 2025-05-28
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("monitoring_history")
@ApiModel(value = "MonitoringHistory对象", description = "监控执行历史")
public class MonitoringHistory extends Model<MonitoringHistory> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "history_id", type = IdType.AUTO)
    private Long historyId;

    @ApiModelProperty("监控文件夹ID")
    @TableField("folder_id")
    private Integer folderId;

    @TableField("status")
    private String status;

    @ApiModelProperty("错误信息")
    @TableField("error_message")
    private String errorMessage;

    @ApiModelProperty("执行耗时(ms)")
    @TableField("execution_time")
    private Integer executionTime;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField(exist = false)
    private MonitoredFolders folders;

    @Override
    public Serializable pkVal() {
        return this.historyId;
    }
}
